#include "OptionType.h"
#include "OptionTypeBool.h"
using namespace inilib;


OptionTypeBool::OptionTypeBool ( 
	const std::string & optionName,
	Mandatory isMandatory,
	ValuesAmount amount,
	bool defaultValue,
	char separator
)
	: OptionType( optionName, isMandatory, amount, separator )
{
	if ( defaultValue )
	{
		m_DefaultValue.push_back( "t" );
	}
	else
	{
		m_DefaultValue.push_back( "f" );
	}
}


std::vector< std::string > OptionTypeBool::GetDefaultValue () const
{
	return m_DefaultValue;
}


bool OptionTypeBool::AreValuesValid_ ( const std::vector< std::string > & values ) const
{
	for ( size_t i = 0; i < values.size(); ++i )
	{
		if (
			values[ i ] == "1" ||
			values[ i ] == "t" ||
			values[ i ] == "y" ||
			values[ i ] == "on" ||
			values[ i ] == "yes" ||
			values[ i ] == "enabled" ||
			values[ i ] == "0" ||
			values[ i ] == "f" ||
			values[ i ] == "n" ||
			values[ i ] == "off" ||
			values[ i ] == "no" ||
			values[ i ] == "disabled"
			)
		{
			continue;
		}

		return false;
	}

	return true;
}